package com.martin.dms.web.services;

import java.util.List;

import com.martin.dms.web.beans.CategoryBean;
import com.martin.dms.web.beans.ItemBean;
import com.martin.dms.web.beans.ItemManagementBean;

/**
 * Service used to control the Item web flow.
 * 
 * @author mtsvetkov
 */
public interface ItemFlowService {

    /**
     * Retrieves all categories and places them in <code>CategoryBean</code>s.
     * 
     * @return a list with all categories.
     */
    public List<CategoryBean> getAllCategories();

    /**
     * Searches for items by the criteria contained in the <code>ItemManagementBean</code>.
     * 
     * @param bean - management bean.
     * @param searchForItems - if false the search will not be performed.
     * @return a list with the found items or an empty list if <code>searchForItems</code> is false.
     */
    public List<ItemBean> searchItems(ItemManagementBean bean, boolean searchForItems);

    /**
     * Retrieves an item and places it in a <code>ItemBean</code>.
     * 
     * @param id - the id of the item.
     * @param copyAllData - if true the <code>ItemBean</code> will be filled with all the data from
     *            the item. If false only the id and the name of the item will be filled.
     * @return an <code>ItemBean</code>.
     */
    public ItemBean getItem(long id, boolean copyAllData);

    /**
     * Deletes the given <code>item</code>.
     * 
     * @param item to delete.
     */
    public void deleteItem(ItemBean item);

    /**
     * Saves the <code>item</code>.
     * 
     * @param item to save.
     */
    public void saveItem(ItemBean item);
}
